package com.zff.rental.controller.apartment;


import com.zff.rental.AppConstant;
import com.zff.rental.common.PageVo;
import com.zff.rental.common.Result;
import com.zff.rental.service.apartment.SuitesTypeServer;
import com.zff.rental.vo.apartment.suites.AddSuitesTypeParams;
import com.zff.rental.vo.apartment.suites.ModifySuitesTypeParams;
import com.zff.rental.vo.apartment.suites.SuitesTypeListParams;
import com.zff.rental.vo.apartment.suites.SuitesTypeVo;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


/**
 * 套间类型管理
 *
 * @author HCY
 */
@RestController
@RequestMapping(AppConstant.RM_SUITES_MANAGE)
public class SuitesTypeManageController {
    @Resource
    private SuitesTypeServer suitesTypeServer;

    /**
     * 添加套间类型
     */
    @PostMapping("/add")
    public Result<SuitesTypeVo> add(@Validated @RequestBody AddSuitesTypeParams params) {
        SuitesTypeVo result = suitesTypeServer.add(params);
        return Result.success(result);
    }

    /**
     * 修改套间类型
     */
    @PostMapping("/modify")
    public Result<SuitesTypeVo> modify(@Validated @RequestBody ModifySuitesTypeParams params) {
        SuitesTypeVo result = suitesTypeServer.modify(params);
        return Result.success(result);
    }

    /**
     * 删除套间类型
     */
    @GetMapping("/remove")
    public Result<Boolean> remove(@RequestParam("id") Long id) {
        Boolean result = suitesTypeServer.remove(id);
        return Result.success(result);
    }

    /**
     * 套间类型详情
     */
    @GetMapping("/details")
    public Result<SuitesTypeVo> details(@RequestParam("id") Long id) {
        SuitesTypeVo result = suitesTypeServer.details(id);
        return Result.success(result);
    }

    /**
     * 套间类型列表
     */
    @PostMapping("/list")
    public Result<PageVo<SuitesTypeVo>> list(@RequestBody SuitesTypeListParams params) {
        PageVo<SuitesTypeVo> result = suitesTypeServer.list(params);
        return Result.success(result);
    }
}